<?php

namespace api\modules\v1\controllers\buss;

use services\linkedcare\LinkedcarePatientsFeeDetailService;
use services\spoker\SpokerService;
use Yii;
use api\controllers\OnAuthController;
use yii\db\Exception;
use yii\web\HttpException;

class FeeController extends OnAuthController
{
    public $modelClass = '';

    /**
     * @api {get} /v1/buss/fee/index 消费列表
     * @apiGroup Fee
     * @apiName index
     * @apiUse CommonParam
     *
     * @apiParam {string} keywords
     * @apiParam {string} pay_time_stime
     * @apiParam {string} pay_time_etime
     * @apiParam {int} status
     * @apiParam {int} page
     * @apiParam {int} pageSize
     *
     * @apiSuccess {Object}  data
     * @apiSuccess {Object}  data.list                  列表数据
     * @apiSuccess {Number}  data.list.id               列表ID
     * @apiSuccess {String}  data.list.pay_time         消费时间
     * @apiSuccess {String}  data.list.name             客户名
     * @apiSuccess {Number}  data.list.patient_id       客户ID
     * @apiSuccess {String}  data.list.item_name        项目
     * @apiSuccess {String}  data.list.shop_name        门店
     * @apiSuccess {String}  data.list.doctor_name      医生
     * @apiSuccess {Number}  data.list.actual_price     收费金额
     * @apiSuccess {String}  data.list.spoker_name      代言人
     * @apiSuccess {Array}  data.condition.spoker_arr   代言人筛选列表
     *
     */
    public function actionIndex()
    {
        $params = Yii::$app->request->get();

        $page = $params['page'] ?? 1;
        $pageSize = $params['pageSize'] ?? 10;
        $service = new LinkedcarePatientsFeeDetailService();
        $list['list'] = $service->feeList($params, $page, $pageSize);
        $list['condition']['spoker_arr'] = SpokerService::getListCondition();
        return $list;

    }
}
